#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<string>
#include<vector>
#include<stack>
using namespace std;
class Solution12
{
public:
    string longestPalindrome(string s)
    {
        string ret;
        int left,right,cur = 0;
        while (cur < s.size())
        {
            left = cur,right = cur;
            while (left >= 0 && right < s.size())
            {
                if (s[left] == s[right])
                {
                    left--;right++;
                }
                else
                    break;
            }
            if (right - left - 1 > ret.size()) ret = s.substr(left + 1,right - left - 1);
            //
            left = cur,right = cur + 1;
            if (s[left] == s[right])
            {
                while (left >= 0 && right < s.size())
            {
                    if (s[left] == s[right])
                    {
                        left--;right++;
                    }
                    else
                        break;
            }
            if (right - left - 1 > ret.size()) ret = s.substr(left + 1,right - left - 1);
            }
            cur++;
        }
        return ret;
    }
};
class Solution33
{
public:
    string multiply(string num1, string num2)
    {
        string ret;
        vector<int> arr(num1.size() + num2.size()-1, 0);
        reverse(num1.begin(), num1.end());
        reverse(num2.begin(), num2.end());
        for (int i = 0;i < num1.size();i++)
        {
            for (int j = 0;j < num2.size();j++)
            {
                arr[i + j] += (num1[i] - '0') * (num2[j] - '0');
            }
        }
        int carry = 0, pos = 0;
        while (carry ||pos< num1.size() + num2.size() - 1)
        {
            if (pos < num1.size() + num2.size() - 1) carry += arr[pos];
            ret += carry % 10 + '0';
            carry /= 10;
            pos++;
        }
        reverse(ret.begin(), ret.end());
        return ret;

    }
};
class Solution99 {
public:
    bool backspaceCompare(string s, string t)
    {
        string ret1, ret2;
        for (auto ch : s)
        {
            if (ch == '#') ret1.pop_back();
            else ret1 += ch;
        }
        for (auto ch : s)
        {
            if (ch == '#') ret2.pop_back();
            else ret2 += ch;
        }
        if (ret1 == ret2)
            return true;
        else
            return false;

    }
};
class Solution
{
public:
    bool validateStackSequences(vector<int>& pushed, vector<int>& popped)
    {
        int i = 0, j = 0;
        stack<int> test;
        while (i < pushed.size() && j < popped.size())
        {
            if (test.empty()) test.push(pushed[i++]);
            while (test.size()&&i< pushed.size()&&popped[j] != test.top()) test.push(pushed[i++]);
            while (test.size() && j < popped.size() &&popped[j] == test.top())
            {
                test.pop();
                j++;
            }
        }
        while (test.size() && popped[j++] == test.top()) test.pop();
        return !test.empty();
    }
};
//int main()
//{
//    int a = INT_MIN;
//    string s = "a#c",s1= "b";
//    vector<int> v={ 1,2,3,4,5,6,7 };
//    vector<int> vv={ 1,2,5,3,6,7,4 };
//    Solution().validateStackSequences(v, vv);
//    return 0;
//}
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<time.h>

int main()
{
    int N = 0;
    scanf("%d", &N);
    int i, a;
    for (i = pow(10, N - 1); i <= pow(10, N) - 1; i++)
    {
        int sum = 0;
        if (i == 153)
        {
            int a = 0;
        }
        int tmp = i;
        while (tmp > 0)
        {
            a = tmp % 10;
            sum += pow(a, N);
            tmp /= 10;
        }
        if (sum == i)
        {
            printf("%d\n", i);
        }
    }
    return 0;
}